import requests


class IHRMDepManageApi:
    @classmethod
    def dep_add_manage(self,token,depart_add_body):
        depart_add_manage = "http://ihrm2-test.itheima.net/api/company/department"
        depart_add_head = {"Content-Type": "application/json",
                           "Authorization": token}
        resp = requests.post(url=depart_add_manage, headers=depart_add_head, json=depart_add_body)
        return resp
    @classmethod
    def dep_query_manage(cls,emp_id,token):
        depart_query_url = "http://ihrm2-test.itheima.net/api/company/department/"+emp_id
        depart_query_head = {"Authorization": token}
        resp = requests.get(url=depart_query_url, headers=depart_query_head)
        return resp
    @classmethod
    def dep_put_manage(cls,emp_id,token,body):
        url = "http://ihrm2-test.itheima.net/api/company/department/"+emp_id
        head = {"Content-Type": "application/json",
                              "Authorization": token}
        resp = requests.put(url=url, headers=head, json=body)
        return resp
    @classmethod
    def dep_delete_manage(cls,emp_id,token):
        url = "http://ihrm2-test.itheima.net/api/company/department/"+emp_id
        head = {"Authorization": token}
        resp = requests.delete(url=url, headers=head)
        return resp
